import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '@/views/layout/index'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/energy'
  },
  {
    path: '/layout',
    component: layout,
    children: [
      {
        path: 'credit',
        name: 'Credit',
        meta: { title: '西兴街道信用停驾驶舱', go: 'http://10.32.39.216:8080/dist/index.html#/index' },
        component: () => import('@/views/credit/index')
      },
      {
        path: 'energy',
        name: 'Energy',
        meta: { title: '西兴驿·活力驿', go: 'http://10.32.39.216:8080/dist/index.html#/index' },
        component: () => import('@/views/energy/index')
      },
      {
        path: 'Warning',
        name: 'Warning',
        meta: { title: '活力驿·预警详情', go: 'energy', keepAlive: true },
        component: () => import('@/views/warning/index')
      },
      {
        path: 'company',
        name: 'Company',
        meta: { title: '活力驿·企业网格', go: 'energy' },
        component: () => import('@/views/company/index')
      },
      {
        path: 'location',
        name: 'Location',
        meta: { title: '活力驿·定位社区', go: 'energy' },
        component: () => import('@/views/location/index')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
